<template>
  <section>
    <!--start 面包屑-->
    <div class="location">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{path:'/index'}">首页</el-breadcrumb-item>
        <el-breadcrumb-item>商品</el-breadcrumb-item>
        <el-breadcrumb-item>商品列表</el-breadcrumb-item>
      </el-breadcrumb>
      			<help-components>
				<span slot="headText">{{vue_helpData.templateName}}</span>
				<p slot="headDescText">{{vue_helpData.templateRemark}}</p>
				<div slot="helpContentWrap">
					<div v-for="(item,index) in vue_helpData.questionAndAnswerArray">
						<h3>{{item.templateContent}}</h3>
						<p v-html="item.templateRemark"></p>
					</div>
				</div>
			</help-components>
    </div>
    <!--end 面包屑-->
    <!--start content-->
    <div class="goodsContent">

      <!--高级搜索  start-->
      <div class="height-search">
        <transition name="fade">
          <div class="modal-backdrop" v-show="vue_heightSearch"></div>
        </transition>
        <transition name="slideDown">
          <div class="height-s-con" v-show="vue_heightSearch">
            <p class="search-title">高级搜索</p>
            <el-form ref="Form" :model="vue_form" label-width="80px">
              <el-form-item label="关键词" prop="keyName">
                <el-input v-model="vue_form.keyName" placeholder="请输入商品名称/关键字"></el-input>
              </el-form-item>
              <el-form-item label="商品分类" prop="categoryName">
                <div class="departmentSelectDiv">
            		<span @click.stop="departmentFn">{{vue_tree.categoryName}}</span>
            		<i class="el-icon-caret-bottom" :class="{up:vue_treeShow}"></i>
            		<transition name="selectSlide">
	            		<el-tree
	            			v-show="vue_treeShow"
	            			class="departmentTree"
	                  :data="vue_tree"
	                  :props="defaultProps"
	                  node-key="treeCode"
	                  accordion
	                  :expand-on-click-node="false"
	                  @node-click="handleNodeClick">
	                </el-tree>
                </transition>
            	</div>
              </el-form-item>
              <el-form-item label="商品品牌" prop="brandName">
                <el-select v-model="vue_form.brandCode" placeholder="请选择商品品牌">
                  <el-option v-for="item in vue_brands"
											:key="item.brandCode"
											:label="item.brandName"
											:value="item.brandCode">
										</el-option>
                </el-select>
              </el-form-item>
              <el-form-item style="width: 100%" label="商品标签" prop="goodLabel">
                <el-checkbox-group v-model="vue_form.type">
                  <el-checkbox :label="item.ddlistCode" :value="item.ddlistCode" :key="item.ddlistCode"  :name="item.ddlistCode" v-for=" item in vue_tags">{{item.ddlistName}}</el-checkbox>
                </el-checkbox-group>
              </el-form-item>
              <el-form-item style="width: 100%" label="商品状态" prop="state">
                <el-radio-group v-model="vue_form.state">
                	<el-radio label="">全部状态</el-radio>
                  <el-radio v-for="item in vue_dataBillstates" :label="item.ddlistKey" v-if="item.state=='1'">{{item.ddlistName}}</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label-width="15px">
                <el-button @click="advSearch_sure" type="primary">确定</el-button>
                <el-button @click="advSearch_cancel">取消</el-button>
                <el-button @click="advSearch_clear" type="text">清空</el-button>
              </el-form-item>
            </el-form>
          </div>
        </transition>
      </div>
      <!--高级搜索  end-->

      <!--头部  start-->
      <div class="piliangCao sousuo " v-if="vue_sousuo">
				搜索结果
				<em style="font-style: normal;margin: 0px 20px;">|</em>
				<a @click="advSearch_qingchu"><em class="iconfont">&#xe66b;</em>清除搜索</a>
				<a @click="advSearch_jixusou"><em class="iconfont">&#xe62d;</em>继续搜索</a>
			</div>
      <div class="public-th clearfix employNum-heard" v-if="vue_selectAllData> 0 && vue_sousuo==false">
        <em @click="row_selectAll" class="el-icon-close"></em>
        <span class="selectSpan">已选择<i>{{vue_selectAllData}}</i>项</span>
        <b class="selectB">|</b>
        <span class="selectSpan" @click='batchApply'><em class="iconfont">&#xe657;</em>上架</span>
        <span class="selectSpan" @click='batchSoldOut'><em class="iconfont">&#xe664;</em>下架</span>
        <span class="selectSpan" @click='batchAuditPass' v-if="vue_auditpass"><em class="iconfont" style="position: relative;top: -2px;">&#xe6f1;</em>上架审核</span>
        <span class="selectSpan" @click='batchDelete'><em class="iconfont">&#xe616;</em>删除</span>
      </div>
      <div class="employNum-heard" v-if="vue_selectAllData==0">
        <div class="slideBtn fl" @click.stop="stateType">
          <el-dropdown menu-align="start" trigger="click" @command="handleCommandState">
            <span class="el-dropdown-link">{{vue_slideBtnMsgState}}<i :class="{up:vue_allState}" class="el-icon-arrow-down el-icon--right slideBtnIcon"></i></span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="全部状态">全部状态</el-dropdown-item>
              <el-dropdown-item :command="item.ddlistName" v-for="item in vue_dataBillstates" v-if="item.state=='1'">{{item.ddlistName}}</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
        <div class="public-left clearfix fl">
          <div class="goods-input"><input @keydown.enter="generalSearch_ok" type="text" placeholder="请输入商品名称/关键字" v-model="saleGoodsQb.fullTextFilterStr"/><i @click="generalSearch_ok"></i></div>
        </div>
        <span class="fl high_search" @click="vue_heightSearch=true">高级搜索</span>
        <el-button class="fr" type="primary" @click="row_addNewGood" style="margin-left: 10px">新增</el-button>
        <!--<el-button class="fr" @click="" style="border-color: #13C19F;color: #13C19F">导入</el-button>-->
        <!--<el-button class="fr"  @click="">导出</el-button>-->
      </div>
      <!--头部  end-->
      <!--table表格数据   start-->
      <el-table
        ref="multipleTable"
        :data="vue_tableData"
        tooltip-effect="dark"
        :max-height="vue_tableH"
        style="width: 100%;"
        @sort-change="vFun_sort"
        @selection-change="handleSelectionChange">
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          prop="goodsBigPic"
          class-name="nonePadding"
          label-class-name="nonePadding"
          label="图片"
          width="80">
          <template scope="scope">
            <el-popover trigger="hover" placement="right-start">
                <img class="hoverImg" :src="vue_tableData[scope.$index].goodsBigPic"/>
              <div slot="reference" class="goodImg-Box">
                <el-tag><img class="goodImg"  @click="row_goDetail(scope.$index, vue_tableData)" style="z-index: 200;" :src="vue_tableData[scope.$index].goodsBigPic"></el-tag>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column
          prop="goodsNo"
          label="商品编码"
          class-name="hidde"
          width="140"
          show-overflow-tooltip>
          <template scope="scope"><span class="goTo" @click="row_goDetail(scope.$index, vue_tableData)">{{ scope.row.goodsNo}}</span></template>
        </el-table-column>
        <el-table-column
          prop="goodsName"
          label="商品名称"
          class-name="hidde"
          sortable="custom"
          width="180"
          show-overflow-tooltip>
          <template scope="scope"><span class="goTo" @click="row_goDetail(scope.$index, vue_tableData)">{{ scope.row.goodsName}}</span></template>
        </el-table-column>
        <el-table-column
          prop="categoryName"
          width="130"
          class-name="hidde"
          show-overflow-tooltip
          label="商品分类">
        </el-table-column>
        <el-table-column
          prop="brandName"
          width="130"
          class-name="hidde"
          label="品牌">
        </el-table-column>
        <el-table-column
          prop="goodsSkuValue"
          label="商品规格"
          show-overflow-tooltip
          class-name="hidde"
          width="260">

        </el-table-column>
        <el-table-column
          prop="goodsSalePrice"
          label="市场价"
          class-name="hidde"
          sortable="custom"
          width="130">
        </el-table-column>
        <el-table-column
          prop="dataBillstateStr"
          sortable="custom"
          class-name="hidde"
          label="状态">
        </el-table-column>
        <el-table-column
          prop="goodsTagsStr"
          sortable="custom"
          min-width="200"
          class-name="hidde"
          label="商品标签">
        </el-table-column>
        <el-table-column
          fixed="right"
          label=""
          width="60">
          <template scope="scope">
            <el-popover trigger="hover" placement="bottom">
              <p class="p" @click="row_updateGoodBtn(scope.$index, vue_tableData)"><em class="iconfont" style="font-size: 15px">&#xe617;</em>修改</p>
              <p class="p" @click="deleteGoodBtn(scope.$index, vue_tableData)"><em class="iconfont" style="font-size: 16px">&#xec50;</em>删除</p>
              <div slot="reference" class="name-wrapper">
                <el-tag><em class="iconfont tab-hover">&#xe607;</em></el-tag>
              </div>
            </el-popover>
          </template>
        </el-table-column>
      </el-table>
      <!--table表格数据   end-->
      <!--分页  start-->
      <div class="block">
        <el-pagination
          @size-change="page_handleSizeChange"
          @current-change="page_handleCurrentChange"
          :current-page="parseInt(saleGoodsSet.pageTools.pageNo)"
			:page-sizes="saleGoodsSet.pageTools.pageSizeOptions"
			:page-size="parseInt(saleGoodsSet.pageTools.pageSize)"
			:total="parseInt(saleGoodsSet.pageTools.recordCount)"
          layout="total, prev, pager, next, sizes,jumper">
        </el-pagination>
      </div>
      <!--分页  end-->

    </div>
    <!--end content-->
  </section>
</template>


<script>
  import helpComponents from '../../../components/help/help'
	export default {
		components:{helpComponents},
    data(){
      return {
      	vue_helpData:{
					templateName:"",
					templateRemark:"",
					questionAndAnswerArray:[]
				},

      	vue_sousuo:"",
      	vue_tableH:500,
        vue_showImg:false,
        vue_gode:null,
        vue_treeShow:false,                    //高级搜索的树
        vue_heightSearch: false,            //高级搜索显示
        vue_selectAllData: '',                 //复选框根据数值判断显示隐藏及选中条数显示
        vue_allState: false,                   //全部状态下拉箭头旋转
        vue_goodsCodeStr:'',
        vue_slideBtnMsgState: '全部状态',      //全部状态默认
        //vue_fullTextFileds:'',                 //搜索框模糊搜索
        vue_brands:'',                         //商品品牌集合
        vue_tags:'',                           //商品标签集合
        vue_ddtypeCode:"00100000001",          //商品标签数据字典类型
        vue_dataBillstates:[
           {
           	"ddlistKey":"6",
           	"ddlistName":"上架",
           	"state":"1"
           },{
           	"ddlistKey":"0,1,2,35,5,9,-1,-2",
           	"ddlistName":"下架",
           	"state":"1"
           }
        ],                 //商品状态集合
        vue_bfFlowStepDataBillstates:'',       //商品状态节点集合
        vue_tableData: [],
        vue_form: {                           //高级搜索数据
          keyName: '',                    //关键字
          categoryName:'',                    //商品分类
          brandCode:'',                   //商品品牌代码
          brandName:'',                   //商品品牌
          departmentCode:0,
          goodLabel:'',                   //商品标签
          type: [],                       //商品标签
          state:'',                       //商品状态
          resource: '',                   //商品来源
        },
        vue_tree:[],                          //商品分类树
        defaultProps: {
          children: 'children',
          label: 'treeName'
        },
        saleGoodsSet: {
					"list":[],  //数据列表
				  "pageTools":{},	//分页数据
					"sumInfo":{}, //汇总信息
				},
				saleGoodsQb:{
				"dataBillstate":"",
				"fullTextFilterStr":"",
				"categoryCode":"",
				"brandCode":"",
				"goodsTags":"",
				"orderStr":""
			},
//-----------------流程自动化配置
        vue_saleGoodsParamKey:"SaleGoods001",  //商品流程设置key
        vue_saleGoodsParamViewVo:"",           //商品流程自定义对象
        vue_saleGoodsParamValueMap:"",         //商品流程
				vue_auditpass:true,                   //上架审核是否显示
      }
    },
    methods:{
    	vFun_sort(type){
    		if(type.order==='ascending'){
    			this.saleGoodsQb.orderStr=type.prop
    		}else if(type.order==='descending'){
    			this.saleGoodsQb.orderStr=type.prop +' desc'
    		}else{
    			this.saleGoodsQb.orderStr=''
    		};
    		this.queryByPage();
    	},
			query_systemData(){
							this.axios({
								method:"GET",
								url:"/v3/system/templates/001000000012"
							}).then((res)=>{
									this.vue_helpData.templateName = res.data.templateName;
									this.vue_helpData.templateRemark = res.data.templateRemark;
									this.vue_helpData.questionAndAnswerArray = res.data.questionAndAnswerArray;
							}).catch((err)=>{
								this.Public.openError(this,err.response.data)
							})
						},

//--------------------查询商品列表--------------------------------------
      queryByPage(){
      	 this.axios({
              method: 'post',
              url: "/v3/sale/goodss/list",
              data: {
                "offset":(this.saleGoodsSet.pageTools.pageNo-1)*this.saleGoodsSet.pageTools.pageSize,
                "limit":this.saleGoodsSet.pageTools.pageSize,
                "fullTextFilterStr":this.saleGoodsQb.fullTextFilterStr,
                "categoryCode":this.saleGoodsQb.categoryCode,
                "brandCode":this.saleGoodsQb.brandCode,
                "goodsTags":this.saleGoodsQb.goodsTags,
                "dataBillstate":this.saleGoodsQb.dataBillstate,
                "orderStr":this.saleGoodsQb.orderStr
              }
        }).then((res) => {
          	res.data.list.forEach((item,index,arr)=>{
           	   item.goodsSalePrice = this.Public.formatMoney(item.goodsSalePrice,2);
          	});
          	this.vue_tableData = res.data.list;
          	this.saleGoodsSet.sumInfo = res.data.sumInfo;
          	this.saleGoodsSet.pageTools = res.data.pageTools;
          	this.saleGoodsSet.pageTools.pageSizeOptions = JSON.parse(this.saleGoodsSet.pageTools.pageSizeOptions);
        }).catch((err)=>{
					  this.Public.openError(this,err.response.data)
				});
      },

//-------------------搜索栏模糊搜索-----------------------------------
      generalSearch_ok(){
      	this.saleGoodsSet.pageTools = this.$store.state.page;
      	this.queryByPage();
      },

//-------------------跳往商品详情  start--------------------------------
      row_goDetail(index,data){
        this.$router.push('/goods/goodDetails');
        this.Public.setCookie("goodsCode",data[index].goodsCode,1);
      },

//-------------------------高级搜索     start----------------------------
			advSearch_rest() {
			 this.vue_form.keyName = "";
		 	 this.vue_tree.categoryCode = "";
			 this.vue_tree.categoryName = "";
			 this.vue_form.brandCode = "";
			 this.vue_form.type = [];
			 this.vue_form.state = "";
		  },
      advSearch_cancel(){
        this.vue_heightSearch = false;
        this.$refs.Form.resetFields();
	      /* start 重置高级搜索条件 */
	      this.advSearch_rest();
	      /* end 重置高级搜索条件 */
	     this.vue_selectAllData="0";
	     this.vue_sousuo=false;
	     this.generalSearch_ok='';
      },
      advSearch_clear(){
        this.$refs.Form.resetFields();
	      /* start 重置高级搜索条件 */
	      this.advSearch_rest();
	      /* end 重置高级搜索条件 */
      },
      advSearch_sure(){
      	  this.generalSearch_ok='';
          this.saleGoodsQb.fullTextFilterStr = this.vue_form.keyName;            //关键词
          this.saleGoodsQb.categoryCode = this.vue_tree.categoryCode;         //商品分类代码
          this.saleGoodsQb.brandCode = this.vue_form.brandCode;               //商品品牌代码
          var goodsTags= this.vue_form.type;                  //商品标签数组
          this.saleGoodsQb.dataBillstate = this.vue_form.state;
          this.saleGoodsQb.goodsTags='';
          if(goodsTags.length>0){
        	  for(var i=0;i<goodsTags.length;i++){
							this.saleGoodsQb.goodsTags += goodsTags[i]+","
						}
            this.saleGoodsQb.goodsTags = this.saleGoodsQb.goodsTags.substring(0,this.saleGoodsQb.goodsTags.length-1);
          }
          this.queryByPage();
          this.vue_heightSearch = false;
          /* start 重置高级搜索条件 */
//        this.form.keyName = "";
//	      this.tree.categoryCode = "";
//        this.tree.categoryName = "";
//        this.form.brandCode = "";
//        this.form.type = [];
//        this.form.state = "";
          /* end 重置高级搜索条件 */
//        this.$refs.Form.resetFields();
          this.vue_sousuo=true;
          this.vue_selectAllData="2";
      },
			advSearch_qingchu(){						//清除搜索
				  this.advSearch_rest();
					this.vue_sousuo=false;
					this.vue_selectAllData="0";
					this.saleGoodsQb.fullTextFilterStr="";
          this.saleGoodsQb.categoryCode = "";
          this.saleGoodsQb.brandCode = "";
          this.saleGoodsQb.dataBillstate = "";
          this.saleGoodsQb.goodsTags = "";
          /* end 重置高级搜索条件 */
          this.$refs.Form.resetFields();
          //---------------------------页面数据渲染--------------------------
          this.saleGoodsSet.pageTools = this.$store.state.page;
		      this.queryByPage();
		      this.query_goodsBrands();
		      this.query_basicDdtypeListAll();
      },
		advSearch_jixusou(){						//继续搜索
			this.vue_heightSearch = true;
//			if (this.radio2=='') {
//				this.radio2='2'
//			}
		},
//---------------------------点击头部关闭按钮   start------------------
      row_selectAll(){
        this.$refs.multipleTable.clearSelection()
      },
//---------------------------表格里的复选框操作   start----------------
      handleSelectionChange(val) {
        this.vue_selectAllData = val.length;
        //获取复选框所有选中商品编号
        this.vue_goodsCodeStr = "";
        if(val.length>0){
        	  for(var i=0;i<val.length;i++){
							this.vue_goodsCodeStr += val[i].goodsCode+","
						}
            this.vue_goodsCodeStr = this.vue_goodsCodeStr.substring(0,this.vue_goodsCodeStr.length-1);
        };
        if (this.vue_selectAllData!=0) {
					this.vue_sousuo=false
				}
      },
//---------------------批量操作   start--------------------
      batchApply(){
        const h = this.$createElement;
        this.$msgbox({
          title: '确认',
          message: h('div', {style: 'padding:20px;'}, [
              h('p', {style: 'text-align: center;font-size: 16px;color: #415161;text-align: center;line-height: 24px;margin-bottom: 8px;'}, '请确认是否上架？'),
            ],
          ),
          customClass: "surePay clearfixBox",
          cancelButtonClass: 'fr',
          confirmButtonClass: 'fr',
          showCancelButton: true,
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(action => {
          if (action === 'confirm') {
             this.axios({
		              method: 'patch',
		              url:"/v3/sale/goodss/"+this.vue_goodsCodeStr+"/batchApply",
		              data:{}
			        }).then((res) => {
			        	  this.saleGoodsSet.pageTools = this.$store.state.page;
			            this.queryByPage();
			            this.Public.openSuccess(this,"操作成功！");
			        }).catch((err)=>{
						      this.Public.openError(this,err.response.data)
					    });
          }
        });
      },

      batchSoldOut(){
        const h = this.$createElement;
        this.$msgbox({
          title: '确认',
          message: h('div', {style: 'padding:20px;'}, [
              h('p', {style: 'text-align: center;font-size: 16px;color: #415161;text-align: center;line-height: 24px;margin-bottom: 8px;'}, '请确认是否下架？'),
            ],
          ),
          customClass: "surePay clearfixBox",
          cancelButtonClass: 'fr',
          confirmButtonClass: 'fr',
          showCancelButton: true,
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(action => {
          if (action === 'confirm') {
             this.axios({
		              method: 'patch',
		              url:"/v3/sale/goodss/"+this.vue_goodsCodeStr+"/batchSoldOut",
		              data:{}
			        }).then((res) => {
			        	this.saleGoodsSet.pageTools = this.$store.state.page;
			          this.queryByPage();
			          this.Public.openSuccess(this,"操作成功！");
			        }).catch((err)=>{
						      this.Public.openError(this,err.response.data)
					    });
          }
        });
      },
//------------------批量删除商品-----------------------
      batchDelete(){
        const h = this.$createElement;
        this.$msgbox({
          title: '确认',
          message: h('div', {style: 'padding:20px;'}, [
              h('p', {style: 'text-align: center;font-size: 16px;color: #415161;text-align: center;line-height: 24px;margin-bottom: 8px;'}, '请确认是否删除商品？'),
            ],
          ),
          customClass: "surePay clearfixBox",
          cancelButtonClass: 'fr',
          confirmButtonClass: 'fr',
          showCancelButton: true,
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(action => {
          if (action === 'confirm') {
             this.axios({
		              method: 'delete',
		              url:"/v3/sale/goodss/"+this.vue_goodsCodeStr,
		              data:{}
			        }).then((res) => {
			        	  this.saleGoodsSet.pageTools = this.$store.state.page;
			            this.queryByPage();
			            this.Public.openSuccess(this,"操作成功！");
			        }).catch((err)=>{
						      this.Public.openError(this,err.response.data)
					    });
          }
        });
      },

//---------------------删除商品   start--------------------
      deleteGoodBtn(index,data){
        const h = this.$createElement;
        this.$msgbox({
          title: '确认',
          message: h('div', {style: 'padding:20px;'}, [
              h('p', {style: 'text-align: center;font-size: 16px;color: #415161;text-align: center;line-height: 24px;margin-bottom: 8px;'}, '是否确认删除商品？'),
            ],
          ),
          customClass: "surePay clearfixBox",
          cancelButtonClass: 'fr',
          confirmButtonClass: 'fr',
          showCancelButton: true,
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(action => {
          if (action === 'confirm') {
               this.axios({
		              method: 'delete',
		              url:"/v3/sale/goodss/"+data[index].goodsCode,
		              data:{}
			        }).then((res) => {
			          	this.saleGoodsSet.pageTools = this.$store.state.page;
			            this.queryByPage();
			            this.Public.openSuccess(this,"操作成功！");
			        }).catch((err)=>{
			        	this.Public.openError(this,err.response.data);
			        });
          }
        });
      },
//----------------------跳转商品修改----------------------
     row_updateGoodBtn(index,data){
     	  this.$router.push('/goods/updateGoods');
        this.Public.setCookie("updateGoodsCode",data[index].goodsCode,1);
     },

//----------------------新增商品跳转链接  start-------------
      row_addNewGood() {
        this.$router.push('/goods/addGoods')
      },

//--------------点击下拉箭头小箭头旋转  start-------------------
      stateType() {
        this.vue_allState = !this.vue_allState;
      },
      handleCommandState: function (command) {
      	this.vue_slideBtnMsgState = command;
      	if(command == "全部状态"){
      		this.saleGoodsQb.dataBillstate = "";
      		this.queryByPage();
      	}
      	for(let i=0;i<this.vue_dataBillstates.length;i++){
      		if(this.vue_dataBillstates[i].ddlistName == command){
      			this.saleGoodsQb.dataBillstate = this.vue_dataBillstates[i].ddlistKey;
        		this.queryByPage();
        	}
      	}
      },

//---------------------------分页     start---------------------------
      page_handleSizeChange(val) {
        this.saleGoodsSet.pageTools.pageSize = val;
        this.queryByPage();
      },
      page_handleCurrentChange(val) {
        this.saleGoodsSet.pageTools.pageNo = val;
        this.queryByPage();
      },
//--------------------------商品分类操作-----------------------------------
      departmentFn(){
      	this.vue_treeShow = !this.vue_treeShow;
      },
      handleNodeClick(data) {
      	this.vue_tree.categoryCode = data.treeCode;
      	this.vue_tree.categoryName = data.treeName;
      	this.vue_treeShow = false;
      },
//-------------------------获取商品分类树-------------------------
    query_goodsCategorysTree(){
    	  this.axios({
	        method: 'post',
	        url: "/v3/goods/categorys/queryTree"
	      }).then((res) => {
	         this.vue_tree = res.data;
	      }).catch((err)=>{
					 this.Public.openError(this,err.response.data)
				});
    },
//------------------------获取商品品牌集合-------------------------
    query_goodsBrands(){
    	  this.axios({
          method: 'post',
          url: "/v3/goods/brands/listAll",
          data:{}
        }).then((res) => {
           this.vue_brands = res.data.list;
        }).catch((err)=>{
					 this.Public.openError(this,err.response.data)
				});
    },
//--------------------------获取所有商品标签-----------------------
    query_basicDdtypeListAll(){
    	 this.axios({
          method: 'post',
          url: "/v3/basic/ddlists/"+this.vue_ddtypeCode+"/listAll",
          data:{}
        }).then((res) => {
          this.vue_tags = res.data.list;
       }).catch((err)=>{
					this.Public.openError(this,err.response.data)
			 });
    },
//--------------------------获取所有商品状态-----------------------
    query_systemDdtypeListAll(){
    	 this.axios({
          method: 'post',
          url: "/v3/system/ddlists/00100000029/listAll",
          data:{}
        }).then((res) => {
          this.vue_dataBillstates = res.data.list;
            /*过滤商品状态*/
	       for(var i=0;i<this.vue_dataBillstates.length;i++){
	       	this.vue_dataBillstates[i].state = "0";
	       	if(this.vue_dataBillstates[i].ddlistKey =="1"||this.vue_dataBillstates[i].ddlistKey =="3"||this.vue_dataBillstates[i].ddlistKey =="6"||this.vue_dataBillstates[i].ddlistKey =="-1"){
	       		this.vue_dataBillstates[i].state = "1";
	       	}
	       	if(this.vue_saleGoodsParamValueMap["auditPass"] == "0"&&this.vue_dataBillstates[i].ddlistKey =="3"){
	       	  this.vue_dataBillstates[i].state = "0";
	        }
	       }
       }).catch((err)=>{
					this.Public.openError(this,err.response.data)
			 });
    },
//-----------------批量复审  start---------------------------
      batchAuditPass(){
          const h = this.$createElement;
      	  this.$confirm('确认批量上架审核？', '确认', {
          message: h('span', {style: 'padding:20px;'},"确认批量上架审核?"),
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					cancelButtonClass: "fr",
					confirmButtonClass: "fr",
					customClass: "clearfixBox"
				}).then(() => {
					//点击确定的回调
					this.axios({
						method: "patch",
						url: "/v3/sale/goodss/"+this.vue_goodsCodeStr+"/batchAuditPass",
						data:{},
					}).then((res) => {
						  this.saleGoodsSet.pageTools = this.$store.state.page;
	            this.queryByPage();
	            this.Public.openSuccess(this,"操作成功！");
					}).catch((err)=>{
							this.Public.openError(this,err.response.data)
					});
				}).catch(() => {
					//点击取消的回调
				});

      },
//--------------------商品流程自定义配置数据-------------------------
	    query_basicParams(){
	    	/*1说明流程存在反之则说明不存在*/
	    	this.axios({
	          method: 'get',
	          url: "/v3/basic/params/"+this.vue_saleGoodsParamKey,
	          data:{}
	        }).then((res) => {
	        		this.vue_saleGoodsParamValueMap = res.data.paramValueMap;
	        		this.vue_saleGoodsParamViewVo = res.data.basicParamViewVo;
	        		if(res.data.paramValueMap!=null && res.data.paramValueMap!=""&&res.data.paramValueMap!=undefined){
	        			this.vue_saleGoodsParamValueMap["auditPass"]==0?this.vue_auditpass=false:this.vue_auditpass=true;
	        		}
	        }).catch((err)=>{
							this.Public.openError(this,err.response.data)
					});
	    },
//-------------------商品状态节点------------------------------------
      query_BfFlowStep(){
      	/*查询商品状态节点,用于过滤商品状态*/
      	this.axios({
	          method: 'post',
	          url: "/v3/bf/flowSteps/listAll",
	          data:{
	          	"billtypeCode":"SaleGoods001",
	          }
	        }).then((res) => {
	        		this.vue_bfFlowStepDataBillstates = res.data.list;
	        }).catch((err)=>{
							this.Public.openError(this,err.response.data)
					});
      }

    },
    created(){
			this.query_goodsCategorysTree();
			//帮助功能
			this.query_systemData();
		},
    mounted(){
//---------------------------页面数据渲染--------------------------
			this.saleGoodsSet.pageTools = this.$store.state.page;
      this.queryByPage();
      this.query_goodsBrands();
      this.query_basicDdtypeListAll();
      this.query_basicParams();
      //this.query_systemDdtypeListAll();

//---------------------------点击下拉箭头旋转----------------------
      document.querySelector('body').onclick = () => {
        if (this.vue_allState == true) {
          this.vue_allState = false;
        }
      };
      document.querySelector("body").onclick = ()=>{this.vue_treeShow = false}
			/* start 动态给table高度 */
			this.vue_tableH = document.documentElement.clientHeight - 225;
			/* end 动态给table高度 */
			document.querySelector(".goodsContent").style.height = (document.documentElement.clientHeight - 180) + 'px';
    }
  }
</script>

<style scoped>

  .goodImg:hover{
    cursor: pointer;
  }

  .hoverImg{
    width: 190px;
    height: 190px;
    margin: 15px;
    background: white;
    z-index: 23;
  }

  .goTo:hover {
    color: #13c19f;
    cursor: pointer;
  }

  /* start 部门下拉的样式 */
  .departmentSelectDiv {
    position: relative;
    width: 100%;
    height: 36px;
    line-height: 36px;
  }
  .departmentSelectDiv>span{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 36px;
    border:1px solid rgb(191, 212, 217);
    border-radius: 4px;
    font-size: 12px;
    padding-left: 10px;
    cursor: pointer;
  }
  .departmentSelectDiv>span:hover{
    border-color: rgb(131, 156, 165);
  }
  .departmentSelectDiv>span:active{
    border-color: #03b8cc;
  }
  .departmentSelectDiv>span:visited{
    border-color: #03b8cc;
  }
  .departmentSelectDiv>span:focus{
    border-color: #03b8cc;
  }
  .departmentSelectDiv>i{
    position: absolute;
    top: 0;
    right: 0;
    width: 35px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    color: rgb(191, 212, 217);
    transition: .3s;
    font-size: 12px;
  }
  .departmentSelectDiv>i.up{
    transform: rotate(180deg);
  }
  .departmentTree {
    position: absolute;
    width: 100%;
    top: 42px;
    left: 0;
    border-radius: 2px;
    box-shadow:0 2px 4px rgba(0,0,0,.12), 0 0 6px rgba(0,0,0,.04);
    z-index: 2;
    font-size: 12px;
    overflow-y: auto;
    height: 200px;
  }
  .selectSlide-enter-active, .selectSlide-leave-active {
    transition: .4s;
  }

  .selectSlide-enter, .selectSlide-leave-active {
    height: 0;
    opacity: 0;
  }
  /* end 部门下拉的样式 */


  .el-form {
    overflow: hidden;
  }

  .el-form .el-form-item:last-child {
    width: 100%;
  }

  .el-form-item {
    width: 485px;
    float: left;
    margin-right: 10px;
  }

  .search-title {
    font-size: 16px;
    border: 0;
    color: #415161;
    margin-bottom: 20px;
  }

  .modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    background-color: rgba(240, 240, 240, 0.2);
  }

  .height-s-con {
    position: absolute;
    width: 100%;
    height: 380px;
    top: 0;
    left: 0;
    padding: 30px;
    z-index: 1005;
    background: #fff;
    box-sizing: border-box;
    box-shadow: 0 0 10px #ccc;
    overflow: hidden;
  }

  .fade-enter-active, .fade-leave-active {
    transition: .4s;
  }

  .fade-enter, .fade-leave-active {
    opacity: 0;
  }

  .slideDown-enter-active, .slideDown-leave-active {
    transition: .4s;
  }

  .slideDown-enter, .slideDown-leave-active {
    height: 0;
    opacity: 0;
  }

  .selectSpan {
    display: block;
    float: left;
    line-height: 37px;
    color: #7b8aa1;
    padding-right: 24px;
  }

  .selectSpan:hover {
    cursor: pointer;
    color: #13c19f;
  }

  .selectSpan em{
    display: inline-block;
    vertical-align: middle;
    margin-top: -3px;
    margin-right: 3px;
  }

  .selectSpan i {
    color: #13c19f;
    margin: 0px 6px;
  }


  .selectB {
    float: left;
    line-height: 37px;
    display: block;
    margin: 0px 30px;
    color: #7b8aa1;
  }

  .el-icon-close {
    font-size: 12px !important;
    display: block;
    float: left;
    line-height: 37px;
    color: #7b8aa1;
    margin-right: 20px;
  }

  .el-icon-close:hover {
    cursor: pointer;
    color: #13c19f;
  }

 .block {
    float: right;
    margin-top: 10px;
  }

  .el-table {
    font-size: 12px;
  }

  p.kael {
    width: 1000px;
    color: red;
  }

  .p {
    text-indent: 10px;
    line-height: 30px;
    cursor: pointer;
  }

  .p em {
    position: relative;
    top: 0px;
    margin-right: 3px;
  }

  .p:hover {
    cursor: pointer;
    background: #eef1f9;
    color: #03B8CC;
  }

  .goodImg{
    width: 40px;
    height: 40px;
    margin:6px 5px 6px 6px;
  }

  .high_search {
    line-height: 36px;
    color: #93a6b7;
    margin-left: 20px;
    cursor: pointer;
  }

  .high_search:hover {
    color: #13C19F;
  }

  .goods-input i {
    background: url(../../../img/sousuo.png) no-repeat;
    height: 20px;
    width: 20px;
    display: inline-block;
    position: relative;
    top: 5px;
    right: 5px;
    cursor: pointer;
  }

  .goods-input:hover {
    border-color: #13C19F;
    transition: 1s;
  }

  .goods-input {
    float: left;
    width: 340px;
    border: 1px solid #cdd9e6;
    border-radius: 4px;
    margin-right: 10px;
    height: 34px;
    cursor: pointer;
  }

  .goods-input input {
    display: block;
    float: left;
    width: 290px;
    height: 32px;
    font-size: 12px;
    border: 0;
    margin-left: 20px;
  }

  .slideBtn {
    line-height: 36px;
    margin-right: 26px;
  }

  .slideBtn div span {
    cursor: pointer;
    display: block;
  }

  .slideBtn div {
    font-size: 12px;
  }

  .slideBtnIcon {
    transition: .4s;
  }

  .slideBtnIcon.up {
    transform: rotate(-180deg);
  }

  .employNum-heard {
    padding-top: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    padding-left: 16px;
  }

  * {
    transition: .2s;
    box-sizing: border-box;
  }

  section {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  div.location {
    flex: 0 0 10px;
    padding: 3px 0 15px 0;
  }

  div.goodsContent {
    position: relative;
    flex: 1;
    width: 100%;
    background-color: #fff;
    padding: 0 20px 20px 20px;
  }

 /* start 商品分类下拉的样式 */
.departmentSelectDiv {
	position: relative;
	width: 100%;
	height: 36px;
	line-height: 36px;
}
.departmentSelectDiv>span{
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 36px;
	border:1px solid rgb(191, 212, 217);
	border-radius: 4px;
	font-size: 12px;
	padding-left: 10px;
	cursor: pointer;
}
.departmentSelectDiv>span:hover{
	border-color: rgb(131, 156, 165);
}
.departmentSelectDiv>span:active{
	border-color: #03b8cc;
}
.departmentSelectDiv>span:visited{
	border-color: #03b8cc;
}
.departmentSelectDiv>span:focus{
	border-color: #03b8cc;
}
.departmentSelectDiv>i{
	position: absolute;
	top: 0;
	right: 0;
	width: 35px;
	height: 36px;
	line-height: 38px;
	text-align: center;
	color: rgb(191, 212, 217);
	transition: .3s;
	font-size: 12px;
}
.departmentSelectDiv>i.up{
	transform: rotate(180deg);
}
.departmentTree {
	position: absolute;
	width: 100%;
	top: 42px;
	left: 0;
	border-radius: 2px;
	box-shadow:0 2px 4px rgba(0,0,0,.12), 0 0 6px rgba(0,0,0,.04);
	z-index: 2;
	font-size: 12px;
	overflow-y: auto;
	height: 200px;
}
.selectSlide-enter-active, .selectSlide-leave-active {
    transition: .4s;
  }

  .selectSlide-enter, .selectSlide-leave-active {
    height: 0;
    opacity: 0;
  }
 /* end 商品分类下拉的样式 */
*{
	box-sizing: border-box;
	transition: .2s;
}
.piliangCao{
		margin-left: -6px;
		height: 45px;
		line-height: 36px;
	}
	.piliangCao em {
		font-size: 14px;
	}

	.piliangCao a {
		cursor: pointer;
		color: #768696;
		margin-right: 20px;
	}
	.sousuo{
		margin-left: 15px;
		margin-top: 10px;
	}
	.piliangCao a:hover{
		color: #03B8CC;
	}
</style>
